//
//  Config.h
//  TianjinBoHai
//
//  Created by 李莹 on 15/1/16.
//  Copyright (c) 2015年 Binky Lee. All rights reserved.
//

#import "UIFont+Device_iPhoneModel.h"
#import <UIKit/UIKit.h>

#pragma mark --------log
#define VOTETEXTCOLOR [UIColor colorWithRed:0.47 green:0.47 blue:0.47 alpha:1]

//通用字号
#define DEF_FontSize_26 [UIFont fontSize:26]
#define DEF_FontSize_18 [UIFont fontSize:18]
#define DEF_FontSize_17 [UIFont fontSize:17]
#define DEF_FontSize_16 [UIFont fontSize:16]
#define DEF_FontSize_15 [UIFont fontSize:15]
#define DEF_FontSize_14 [UIFont fontSize:14]
#define DEF_FontSize_13 [UIFont fontSize:13]
#define DEF_FontSize_12 [UIFont fontSize:12]
#define DEF_FontSize_11 [UIFont fontSize:11]
#define DEF_FontSize_10 [UIFont fontSize:10]
#define DEF_FontSize_9 [UIFont fontSize:9]
#define DEF_FontSize_8 [UIFont fontSize:8]

#define Strong @property (nonatomic, strong)
#define Assign @property (nonatomic, assign)
#define Copy @property (nonatomic, copy)

#define CENTER [NSNotificationCenter defaultCenter]
#define DEFAULTS [NSUserDefaults standardUserDefaults]

#define CLWeakObj(o) autoreleasepool{} __weak typeof(o) o##Weak = o;
#define CLStrongObj(o) autoreleasepool{} __strong typeof(o) o = o##Weak;

#define W ([UIScreen mainScreen].bounds.size.width / 375)
#define H ([UIScreen mainScreen].bounds.size.height / 667)

//显示msg
#define ShowMessage(msg) [self.view makeToast:msg duration:1 position:CSToastPositionCenter]

//提示语

#define networkError @"网络连接失败!"
#define stockLast   @"库存不足！"
#define stockLimit  @"商品数量上限为10000！"
#define userNameNull @"账号不能为空！"
#define userPassWordNull @"密码不能为空！"
#define exit @"点击确定退出程序，取消返回"
#define clearShoppingCar @"确认清空购物车？"
#define cardNull @"会员卡号不能为空！"
#define balanceLack @"现金支付金额不足！"
#define payConfirm @"是否确认支付？"
#define payPasswordNull @"请输入支付密码！"
#define numberError @"商品数量不匹配！"

//存储沙盒
#define filePaths [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject]


// 是否iPad
#define someThing (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)? ipad: iphone
#define isPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)

#define BOUND_HEIGHT self.bounds.size.height
#define BOUND_WIDTH self.bounds.size.width

//屏幕宽高

#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height

//按比例计算的宽
#define UNIT_WIDTH(NSInteger) (double)NSInteger / BASE_WIDTH  * SCREEN_WIDTH
//按比例计算的高
#define UNIT_HEIGHT(NSInteger) (double)NSInteger / BASE_HEIGHT * SCREEN_HEIGHT

#define BASE_WIDTH (SCREEN_HEIGHT == 812.0f ? (375.0f * 1.1):(isPad?(1024.0f): 414.0f))
#define BASE_HEIGHT (SCREEN_HEIGHT == 812.0f ?(812.0f * 1.1):(isPad?(768.0f): 736.0f))


//5S宽高比例

#define ScreenBounds [UIScreen mainScreen].bounds
#define WIDTH_5S_SCALE 320.0 * [UIScreen mainScreen].bounds.size.width
#define HEIGHT_5S_SCALE 568.0 * [UIScreen mainScreen].bounds.size.height

//判断是否是iPhoneX机型
#define kDevice_Is_iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)

#define height64  (kDevice_Is_iPhoneX ? 88 : 64)
#define height20  (kDevice_Is_iPhoneX ? 44 : 20)
#define height49  (kDevice_Is_iPhoneX ? 83 : 49)

#define ws(type)  __weak typeof(type) weak##type = type;

/*** MD5 ***/

#define CC_MD5_DIGEST_LENGTH    16          /* digest length in bytes */
#define CC_MD5_BLOCK_BYTES      64          /* block size in bytes */
#define CC_MD5_BLOCK_LONG       (CC_MD5_BLOCK_BYTES / sizeof(CC_LONG))


/**
 * 一般分割线颜色
 */
extern NSString *dividerColor;

/**
 * 字体颜色
 */
extern NSString *textColor;

/**
 * 一般背景颜色
 */
extern NSString *bgColor;

/**
 *  文字按钮  白色
 */
extern NSString *whiteColor;

/**
 *  主颜色
 */
extern NSString *mainColor;

/**
 *  导航栏颜色
 */
extern  NSString *navColor;


@interface Config : NSObject

UIColor* getColor(NSString * hexColor);

@end
